import hashlib
import base64

# 加密MD5

class ToSinge:
    def __init__(self, temp, app_key_secret):
        self.temp = temp
        self.app_key_secret = app_key_secret


    def to_singe(self):
        m = hashlib.md5()
        m.update(self.temp.encode("UTF-8"))
        singe = m.hexdigest()
        return singe

    def to_isco_singe(self):
        md5 = hashlib.md5(self.app_key_secret.encode("UTF-8")).hexdigest()
        sign_base64 = base64.b64encode(md5.encode("utf-8")).decode()
        sign_upper = sign_base64.upper()
        return sign_upper

if __name__ == '__main__':
    singe = ToSinge("123123","123123").to_singe()
    singe2 = ToSinge("123123","123123").to_isco_singe()
    print(singe)
    print(singe2)



